First Order Perturbation Theory (with a triangular perturbation)

pw2[x_,a_,vo_]:=Piecewise[{{0,0≤x≤a/4},{vo (4 x/a-1),a/4<x≤a/2},{vo (-4 x/a+3),a/2≤x≤3 a/4},{0,3 a/4≤x≤a}}]

Plot[pw2[x,1,1],{x,0,1}]

ψ[n_,x_,a_]=(Sqrt[(2/a)]) Sin[n π x/a]

First Order Correction to the Energy

vo=.

eFirstOrder[n_]=Assuming[{x,vo,a}∈Reals && n∈Integers &&a>0,Integrate[((ψ[n,x,a])^2) pw2[x,a,vo],{x,0,a}]]

Table[eFirstOrder[n],{n,1,3}]//N//TableForm

2nd Order Correction to the Energy

ψmψn[m_,n_,x_]=(2/a) Sin[m π x/a] Sin[n π x/a]

en2Neq1=Assuming[{x,vo,a}∈Reals && n∈Integers &&a>0,(∑_(m=2)^20)(((((∫_0^a)ψmψn[m,1,x] pw2[x,a,vo]\[DifferentialD]x))^2)/(e1 (1-(m^2))))]

en2Neq1//N

ψmψn[m, 1, x]

en2Neq2=Assuming[{x,vo,a}∈Reals && n∈Integers &&a>0,Sum[(((((∫_0^a)ψmψn[m,2,x] pw2[x,a,vo]\[DifferentialD]x))^2)/(e1 (4-(m^2)))),{m,{1,3,4,5,6,7,8,9,10}}]]

en2Neq2//N